package com.dy.springcloud.config;


import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
//推荐使用.yml配置gateway
public class GatewayConfig {
    //使用配置类为gateway注入一个路由
//    @Bean
//    public RouteLocator rout1(RouteLocatorBuilder builder) {
//        RouteLocatorBuilder.Builder routes = builder.routes();
//        //使用lambda表达式赋值一个函数接口
//        return routes.route("member_route2", r -> r.path("/member/get/**")
//                .uri("http://localhost:10000"))
//                .build();
//    }
//
//    @Bean
//    public RouteLocator rout2(RouteLocatorBuilder builder) {
//        RouteLocatorBuilder.Builder routes = builder.routes();
//        //使用lambda表达式赋值一个函数接口
//        return routes.route("member_route2", r -> r.path("/member/save")
//                        .uri("http://localhost:10000"))
//                .build();
//    }
}
